<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box {
            position: absolute;
            top: 0px;
            left: 0px;
            width: 200px;
            height: 200px;
        }
        
        .hz1 {
            background-color: red;
            z-index: 2;
            /* 在使用的时候要求position属性不能为static */
            /*    定义不同元素叠放时的显示优先级,数值越高,优先级越高,缺省时默认值为auto*/
        }
        
        .hz2 {
            background-color: green;
            top: 50px;
            left: 50px;
            z-index: 1;
        }
        
        .hz3 {
            background-color: blue;
            top: 100px;
            left: 100px;
            z-index: 0;
        }
    </style>
</head>

<body>
    <div class="box hz1">红色盒子</div>
    <div class="box hz2">绿色盒子</div>
    <div class="box hz3">蓝色盒子</div>
</body>

</html>